package de.gameduell.net.src.header {


	public class HeaderFactory {
		public static const V3:int = 3;	
		
		public function createHeader(version:int,aBodyVersion:int, aServiceType:String,aSlotId:String,aMessageId:int,aTicket:String):IHeader {
			switch(version){
				case(V3): return new Header_V3(aBodyVersion,aMessageId,aServiceType,aSlotId,aTicket);
				default: return null;
			}
		}
		
		public function extractHeader(version:int,data:String, serviceType:String, slotId:String, ticket:String):IHeader{
			switch(version){
				case(V3): 
					var dataList:Array  = data.split("\t");
					var messageId:int   = int(dataList[1]);
					var bodyVersion:int = int(dataList[0].split(".")[1]);
					return new Header_V3(bodyVersion,messageId,serviceType,slotId,ticket);
				default: return null;
			}
		}
	}
	
}
